home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / console / svgatext.3 / svgatext / SVGATextMode-1.3 / Makefile < prev    next >
Encoding:
Makefile  |  1996-04-21  |  8.9 KB  |  334 lines

  1. #
  2. # Makefile for SVGA textmode manipulation program
  3. #
  4. # Authors : Koen Gadeyne
  5. #           Linux/Alpha port: David Mosberger-Tang
  6. #           First DOS port of grabmode: Kenneth Albanowski
  7. #           All other DOS porting: - Stephen Lee
  8. #                                  - DJGPP 2.0
  9. #
  10.  
  11. ARCH=$(shell arch)
  12. CFLAGS_alpha =
  13. CFLAGS_i386  = -pipe
  14. CFLAGS_i486  = $(CFLAGS_i386) -m486
  15. CFLAGS_i586  = $(CFLAGS_i386) -m486         # -mpentium: P5 compiler is not reliable
  16. LDFLAGS_alpha =
  17. LDFLAGS_i386  =
  18. LDFLAGS_i486  = $(LDFLAGS_i386)
  19. LDFLAGS_i586  = $(LDFLAGS_i386)
  20.  
  21. YACC     = bison -y
  22. LEX      = flex -l
  23. LEXFLAGS = -i
  24. YFLAGS   =
  25.  
  26. CDEBUGFLAGS =   # -ggdb
  27.  
  28. CPPFLAGS = $(CONF_FLAGS) $(DEF_CONF) $(DEF_CLOCKCONF) $(STM_VERSION)
  29. CFLAGS = -Wall -O2 $(CDEBUGFLAGS) $(CFLAGS_$(ARCH)) -IXFREE/include
  30. LDFLAGS = $(LDFLAGS_$(ARCH))
  31.  
  32. export CFLAGS
  33.  
  34. # installation path for SVGATextMode
  35. INSTBINDIR = /usr/sbin
  36.  
  37. # installation path for TextConfig. This is also the path that will be
  38. # compiled into SVGATextMode.
  39. INSTCONFDIR = /etc
  40.  
  41. # installation path for the manual files
  42. INSTMANDIR = /usr/man
  43.  
  44. # misc configuration flags.
  45. #
  46. # possible flags are:
  47. #
  48. #     -DRUN_SECURE         Renounce superuser rights immediately after
  49. #                          getting permission for VGA registers, so the
  50. #                          external programs are NOT run as root.
  51. #                          This is only useful if you set the SUID bits on.
  52. #
  53. #     -DNO_DEBUG           Don't include debugging code (for "-d" option)
  54. #                          in all of the tools.
  55. #
  56. #     -DNO_RESIZE          Do not include screen resizing code. This will prohibit
  57. #                          SVGATextMode from resizing the screen, leaving only screen
  58. #                          enhancement functionality. Kernel versions
  59. #                          prior to 1.1.54 NEED this to compile and run without errors.
  60. #
  61. #     -DDOSYNCRESET        Will do a synchronous reset of the timing sequencer before
  62. #                          changing clocks. This seems to crash some ET4000's, although
  63. #                          the data books recommend it...
  64. #
  65. #     -DDOS                Compile for DOS, using a DOS compiler. DJGPP 2.0 recommended.
  66. #                          You MUST (!) use DJGPP 2.0 (released Sept 1995) for this!!!
  67. #                          Currently all instances of "y.tab.*" must be replaced by
  68. #                          "y_tab.*" by hand for compiling under DOS.
  69. #
  70. #     -DVGA_CAN_DO_64KB    This will allow text modes with up to 32k chars instead of the
  71. #                          default 16k. You need a kernel with "VGA_CAN_DO_64KB" defined
  72. #                          in /usr/src/linux/drivers/char/vga.c, so the kernel knows how
  73. #                          to use 64kb of VGA memory instead of 32k.
  74. #
  75.  
  76. CONF_FLAGS = 
  77.  
  78. ############  END  OF  USER  CONFIGURATION  #################################
  79.  
  80.  
  81. VERSION_NUM = 1.3
  82.  
  83.  
  84. STM_VERSION = -DVERSION=\"$(VERSION_NUM)\"
  85.  
  86. CONFIGFILE= $(INSTCONFDIR)/TextConfig
  87. CLOCKCONFIGFILE= $(INSTCONFDIR)/ClockConfig
  88. DEF_CONF = -DCONFIGFILE=\"$(CONFIGFILE)\"
  89. DEF_CLOCKCONF = -DCLOCK_CONF_FILE=\"$(CLOCKCONFIGFILE)\"
  90. XFREELIBS = XFREE/libxf86_hw.a
  91. XFREELINK = -LXFREE -lxf86_hw
  92.  
  93. USERPROGS = SVGATextMode stm clockprobe grabmode
  94. HACKPROGS = setVGAreg getVGAreg setpalette getpalette set80 ClockProg 
  95. #probeclocks
  96.  
  97. BINARIES = $(USERPROGS) $(HACKPROGS)
  98.  
  99. DOSPROGS = grabmode.exe stm.exe clkprobe.exe
  100. DOSHACKPROGS = clkprog.exe setvgarg.exe getvgarg.exe setpal.exe getpal.exe set80
  101.  
  102. default: user
  103.  
  104. all: user hack
  105.  
  106. $(XFREELIBS)::
  107.     $(MAKE) -C XFREE all
  108.  
  109.  
  110. user: $(USERPROGS)
  111.  
  112. hack: $(HACKPROGS)
  113.  
  114. dos: $(DOSPROGS)
  115.  
  116. doshack: $(DOSHACKPROGS)
  117.  
  118. #
  119. # Object files
  120. #
  121.  
  122. STM_OBJECTS = ttyresize.o messages.o vga_prg.o setclock.o file_ops.o SVGATextMode.o \
  123.               validate.o run_extprog.o wait_vsync.o clockchip.o std_clock.o cfglex.o \
  124.               y.tab.o misc.o dump_cfgdata.o
  125.  
  126. CP_OBJECTS = messages.o vga_prg.o setclock.o file_ops.o string_ops.o ClockProg.o \
  127.              validate.o run_extprog.o wait_vsync.o clockchip.o std_clock.o cfglex.o \
  128.              y.tab.o misc.o
  129.  
  130. SET80_OBJECTS = set80.o vga_prg.o messages.o ttyresize.o
  131.  
  132. VGAREG_OBJECTS = setVGAreg.o vga_prg.o file_ops.o string_ops.o messages.o \
  133.                  cfglex.o y.tab.o misc.o
  134.  
  135. PAL_OBJECTS = setpalette.o vga_prg.o string_ops.o messages.o
  136.  
  137. GRAB_OBJECTS = grabmode.o modedata.o probe.o wait_vsync.o vga_prg.o messages.o string_ops.o
  138.  
  139. #PCLKS_OBJECTS = probeclocks.o messages.o vga_prg.o setclock.o file_ops.o \
  140. #                run_extprog.o clockchip.o std_clock.o modedata.o probe.o wait_vsync.o
  141.              
  142.  
  143. #
  144. # UNIX targets
  145. #
  146.  
  147. SVGATextMode: $(STM_OBJECTS) $(XFREELIBS)
  148.     $(CC) $(LDFLAGS) $(STM_OBJECTS) $(XFREELINK) -o $@
  149.     
  150. stm: SVGATextMode
  151.     @if [ ! -x SVGATextMode ]; then \
  152.         make SVGATextMode; \
  153.     fi
  154.     ln -sf SVGATextMode stm
  155.  
  156. ClockProg: $(CP_OBJECTS) $(XFREELIBS)
  157.     $(CC) $(LDFLAGS) $(CP_OBJECTS) $(XFREELINK) -o $@
  158.     
  159.  
  160. #probeclocks: $(PCLKS_OBJECTS) $(XFREELIBS)
  161. #    $(CC) $(LDFLAGS) $(PCLKS_OBJECTS) $(XFREELINK) -o $@
  162.     
  163. set80: $(SET80_OBJECTS)
  164.     $(CC) $(LDFLAGS) $(SET80_OBJECTS) -o $@
  165.     
  166. setVGAreg: $(VGAREG_OBJECTS)
  167.     $(CC) $(LDFLAGS) $(VGAREG_OBJECTS) -o $@
  168.     
  169. getVGAreg: setVGAreg
  170.     ln -sf setVGAreg getVGAreg    
  171.     
  172. setpalette: $(PAL_OBJECTS)
  173.     $(CC) $(LDFLAGS) $(PAL_OBJECTS) -o $@
  174.     
  175. getpalette: setpalette
  176.     ln -sf setpalette getpalette    
  177.     
  178. clockprobe: grabmode
  179.     ln -sf grabmode clockprobe
  180.  
  181. grabmode: $(GRAB_OBJECTS)
  182.     $(CC) $(LDFLAGS) $(GRAB_OBJECTS) -o $@
  183.  
  184. y.tab.c y.tab.h: cfgfile.y messages.c messages.h
  185.     $(YACC) $(YFLAGS) -d $<
  186.  
  187. cfglex.c: cfglex.l y.tab.h messages.c messages.h
  188.     $(LEX) $(LEXFLAGS) -t $< > $@
  189.  
  190.  
  191. #
  192. # DOS targets
  193. #
  194.  
  195. grabmode.exe: $(GRAB_OBJECTS)
  196.     $(CC) $(CFLAGS) $(GRAB_OBJECTS) -o grabmode
  197.     strip grabmode
  198.     stubify grabmode
  199.  
  200. clkprobe.exe: grabmode.exe
  201.     copy grabmode.exe clkprobe.exe
  202.  
  203. stm.exe: $(STM_OBJECTS) $(XFREELIBS)
  204.     $(CC) $(CFLAGS) $(STM_OBJECTS) $(XFREELINK) -o stm
  205.     strip stm
  206.     stubify stm
  207.  
  208. clkprog.exe: $(CP_OBJECTS) $(XFREELIBS)
  209.     $(CC) $(CFLAGS) $(CP_OBJECTS) $(XFREELINK) -o clkprog
  210.     strip clkprog
  211.     stubify clkprog
  212.  
  213. setpal.exe: $(PAL_OBJECTS)
  214.     $(CC) $(CFLAGS) $(PAL_OBJECTS) -o setpal
  215.     strip setpal
  216.     stubify setpal
  217.  
  218. getpal.exe: setpal.exe
  219.     copy setpal.exe getpal.exe
  220.  
  221. setvgarg.exe: $(VGAREG_OBJECTS)
  222.     $(CC) $(CFLAGS) $(VGAREG_OBJECTS) -o setvgarg
  223.     strip setvgarg
  224.     stubify setvgarg
  225.  
  226. getvgarg.exe: setvgarg.exe
  227.     copy setvgarg.exe getvgarg.exe
  228.  
  229. set80.exe: $(SET80_OBJECTS)
  230.     $(CC) $(CFLAGS) $(SET80_OBJECTS) -o set80 
  231.     strip set80
  232.     stubify set80
  233.  
  234.  
  235. #
  236. # install/clean targets
  237. #
  238.  
  239. bininstall:
  240.     @if [ ! -x SVGATextMode ]; then \
  241.         make SVGATextMode; \
  242.     fi
  243.     @if [ ! -x grabmode ]; then \
  244.         make grabmode; \
  245.     fi
  246.     install -s -m 755 SVGATextMode $(INSTBINDIR)
  247.     ln -sf SVGATextMode $(INSTBINDIR)/stm
  248.     install -s -m 755 grabmode $(INSTBINDIR)
  249.     ln -sf grabmode $(INSTBINDIR)/clockprobe
  250.     
  251. man-install maninstall:
  252.     rm -f $(INSTMANDIR)/man8/SVGATextMode.8.gz
  253.     rm -f $(INSTMANDIR)/man8/stm.8.gz
  254.     rm -f $(INSTMANDIR)/man5/TextConfig.5.gz
  255.     rm -f $(INSTMANDIR)/man8/grabmode.8.gz
  256.     rm -f $(INSTMANDIR)/man8/clockprobe.8.gz
  257.     install -m 644 doc/SVGATextMode.man $(INSTMANDIR)/man8/SVGATextMode.8
  258.     install -m 644 doc/TextConfig.man $(INSTMANDIR)/man5/TextConfig.5
  259.     install -m 644 doc/grabmode.man $(INSTMANDIR)/man8/grabmode.8
  260.     ln -sf grabmode.8 $(INSTMANDIR)/man8/clockprobe.8
  261.     ln -sf SVGATextMode.8 $(INSTMANDIR)/man8/stm.8
  262.     
  263. mangz-install mangzinstall compressedmaninstall: man-install
  264.     gzip -v -f -9 $(INSTMANDIR)/man8/SVGATextMode.8
  265.     gzip -v -f -9 $(INSTMANDIR)/man5/TextConfig.5
  266.     gzip -v -f -9 $(INSTMANDIR)/man8/grabmode.8
  267.     ln -sf grabmode.8.gz $(INSTMANDIR)/man8/clockprobe.8.gz
  268.     ln -sf SVGATextMode.8.gz $(INSTMANDIR)/man8/stm.8.gz
  269.     rm -f $(INSTMANDIR)/man8/clockprobe.8
  270.     rm -f $(INSTMANDIR)/man8/stm.8
  271.     
  272. install: bininstall
  273.     @echo
  274.     @if [ ! -f ${CONFIGFILE} ]; then \
  275.         echo "NOTE:" \
  276.         echo "    You must also have an \`$(CONFIGFILE)' file."; \
  277.         echo "    There's an example of such a file in the main SVGATextMode directory."; \
  278.         echo "    (or type \`make newinstall' to install the TextConfig file as well)"; \
  279.     else \
  280.         contrib/scripts/check_TextConf_version $(CONFIGFILE) $(VERSION_NUM); \
  281.     fi
  282.     @echo
  283.     @echo "NOTE:"
  284.     @echo "    To install the manual pages, type \`make man-install',"
  285.     @echo "    or \`make mangz-install' to install compressed man-pages."
  286.     @echo
  287.  
  288. newinstall: bininstall    
  289.     @if [ -f ${CONFIGFILE} ]; then \
  290.         echo "backing up previous $(CONFIGFILE) to $(CONFIGFILE).orig"; \
  291.         cp ${CONFIGFILE} ${CONFIGFILE}.orig; \
  292.     fi
  293.     install -m 644 TextConfig $(CONFIGFILE)
  294.  
  295.  
  296. backup:
  297.     ( cd ..; tar cvzf SVGATextMode-${VERSION_NUM}.tar.gz $(shell basename `pwd`); cd $(shell pwd))
  298.  
  299.  
  300. clean:
  301.     $(RM) *~ *.o *.bak *.orig *.rej
  302.     $(MAKE) -C XFREE clean
  303.  
  304. pristine: mrproper
  305.  
  306. dosclean: clean     # Leaves yacc/lex files in place since I don't have those for DOS
  307.     $(RM) -f $(BINARIES)
  308.     $(MAKE) -C XFREE mrproper
  309.  
  310. distclean: clean
  311.     $(RM) -f $(HACKPROGS) DEADJOE  y.tab.h cfglex.c y.tab.c
  312.     $(RM) -f `find . -name "*~"`
  313.  
  314. mrproper: distclean
  315.     $(RM) -f $(BINARIES)
  316.     $(MAKE) -C XFREE mrproper
  317.  
  318.  
  319.  
  320. #
  321. # dependencies
  322. #
  323.  
  324. depend dep: .depend
  325.  
  326. .depend::
  327.     gcc -MM *.c >.depend
  328.     $(MAKE) -C XFREE depend
  329.  
  330.  
  331. include .depend
  332.  
  333.  
  334.